import {
  IsArray,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  Max,
  Min,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateCommentDto {
  @ApiProperty({ description: '评论内容', example: '商品质量很好' })
  @IsString()
  @IsNotEmpty()
  content: string;

  @ApiProperty({ description: '评分(1-5)', example: 5 })
  @IsNumber()
  @IsNotEmpty()
  @Min(1)
  @Max(5)
  rating: number;

  @ApiProperty({ description: '评论图片URL数组', required: false })
  @IsArray()
  @IsString({ each: true })
  @IsOptional()
  images?: string[];

  @ApiProperty({ description: '商品ID', example: 1 })
  @IsNumber()
  @IsNotEmpty()
  goodsId: number;
}
